/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.belfalas.simy86;

/**
 *
 * @author belfalas
 */
public enum Registradores {

    EAX(0x0),
    ECX(0x1),
    EDX(0x2),
    EBX(0x3),
    ESI(0x6),
    EDI(0x7),
    ESP(0x4),
    EBP(0x5);    
    
    private short code;
    private int usage = 0;
    public int reg;

    Registradores(int code) {
        this.code = (short) code;
    }
    
    public static Registradores getRegistrador(short code){
        for (Registradores reg : Registradores.values()){
            if (code == reg.code) {
                return reg;
            }
        }
        return null;
    }
    
    public int getUsage(){
        return usage;
    }
    
    public void incUsage(){
        this.usage++;
    }
    
    public void decUsage(){
        this.usage--;
    }
    
}
